package com.fa4j.code.mate.model;

import com.fa4j.common.base.model.BaseEnum;
import com.fa4j.common.base.model.CommonState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;


@Schema(description = "代码元数据字段类型")
@Getter
@RequiredArgsConstructor
public enum CodeMateFieldType implements BaseEnum {

    INTEGER(1, "整数",Integer.class,"INTEGER"),
    STRING(2, "字符串",String.class,"VARCHAR"),
    BOOLEAN(3, "布尔",Boolean.class,"BIT"),
    LONG(4, "长整数",Long.class,"BIGINT"),
    DOUBLE(5, "浮点数",Double.class,"DECIMAL"),
    DATETIME(6, "时间日期", LocalDateTime.class,"DATETIME"),
    DATE(7, "日期", LocalDate.class,"DATE"),
    TIME(8, "时间", LocalTime.class,"TIME"),
    OBJECT(9, "对象",Object.class,null),

    COMMON_STATE(101,"通用状态", CommonState.class,"TINYINT UNSIGNED"),
    ;

    private final Integer code;
    private final String name;
    private final Class<?> type;
    private final String dbType;

}
